package jman.competition15;

import java.sql.SQLException;

public class UserService {
	public static String loginUser;
	public boolean Login(String userName,String password) throws SQLException{
		boolean flag=false;
		UserDao ud=new UserDao();
		if(userName!=null&&password!=null){
			User user=ud.getUserByUserName(userName);
			if(password.equals(user.getPassword())){
				flag=true;
			}
		}
		return flag;
	}
	public boolean register(String userName,String password,String sex){
		boolean flag=false;
		User user=new User(userName,password,sex);
		UserDao ud=new UserDao();
		flag=ud.addUser(user);
		return flag;
	}
}
